﻿#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
#include<windows.h>
//{
//	////字符从俩端移动，然后会合到一起形成一句话。
//	//char arr1[] = " wha sbsbsbsbsbsbsbsbsbsb";
//	//int left = 0;
//	//int right = strlen(arr2) - 1;
//	//while (left <= right)
//	//{
//	//	arr2[left] = arr1[left];
//	//	arr2[right] = arr1[right];
//	//	printf("%s\n", arr2);
//	//	Sleep(1000);//延缓程序运行时间，需要加入头文件Windows.h 
//	//	system("cls");//clean scream; need head flie stdlib.h
//
//	//	left++;
//	//	right--;
//	//}
//	//printf("(# ` n ´ )");
//	//输入密码 超过3次退出程序
//	//int i = 0;
//	//char  password[20] = { 0 };//define a place to store the password
//	//printf("input your pasword\n");
//	//for (i = 0; i < 3; i++)
//	//{
//	//	scanf("%s", password);
//	//	if (strcmp(password, "1234567890") == 0)// 需要标注head file string.h,对password 1234567890
//	//	//	作比较如果相等返回0
//	//	{
//	//		printf("log success!\n");
//	//		printf("god bless you (｡･ω･｡)ﾉ♡");
//	//		break;
//	//	}
//	//	else
//	//	{
//	//		printf("password error,please try again sb┐（─__─）┌\n");
//	//	}
//	//}
//	//猜数字游戏
//	
//
//
//		
//		return 0;
//	}
//简单猜数字游戏
	void game()
	{
		//srand((unsigned int)time(NULL));//need head file stdlib.h,time.h
		//srand(10);//need head file stdlib.h,time.h
		//create a random figure
		int guess = 0;
		int ret = rand()%100 + 1;//this function creat a function 
		//printf("%d\n", ret);
		//printf("please guess figure\n");
		//猜数字
		while(1)
		{ 
				printf("please guess figure :>");
				scanf("%d", &guess);
			if (guess > ret)
			{
				printf("guess big\n");
			}
			else if (guess < ret)
			{
				printf("guess small\n");
			}
			else
			{
				printf("congratulation it'as right!\n");
				printf("乾杯 []~（￣▽￣）~* ");
				break;
			}
		}
	}
	void meun()
	{
		printf("*****************************\n");
		printf("********  1. start  *********\n");
		printf("********  2. exilt  *********\n");
		printf("*****************************\n");
	}
	int main()
	{
		int input = 0;
		srand((unsigned int)time(NULL));//need head file stdlib.h,time.h

		do
		{
			meun();
			printf("please make choice.\n");
			scanf("%d", &input);
			switch (input)
			{
			case 1:
				game();
				break;
			case 2 :
				printf("quit game");
				printf("byebye,(^^)/");
				break;
			default:
				printf("choice mistake please try again.");
				break;
			}
		} while (input);
//关机小程序
//	int input[] = { 0 };
//	system("shutdown -s -t 30");
//again: 
//printf("pa attention your computer will shutwdwn at 60 secong late\n");
//printf("输入大帅哥让帅哥解救你电脑\n");
//scanf("%s", &input);
//if (strcmp(input, "hhh") == 0)
//{
//	system("shutdown -a");
//}
//else
//{
//	goto again;
//}
		return 0;
}
